perm filename HAL.PAL[HAL,HE]5 blob
sn#161909 filedate 1975-06-05 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00003 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 .TITLE AL INTERPRETER
C00005 00003 program initialization
C00015 ENDMK
C⊗;
.TITLE AL INTERPRETER
.INSRT HALHED.PAL[HAL,HE]
STSW FLOAT,0 ;1 => put in the floating-string conversions
STSW SMALLB,1 ;1 => use the small block routines
STSW ONMONS,1 ;1 => put in condition monitors
STSW GRAPHS,1 ;1 => put in graph structure
STSW MOVING,0 ;1 => put in the servo
STSW INTLOAD,1 ;1 => put in the interpreter
STSW SNGSTP,1 ;1 => servo in single step mode, wont call scheduler
STSW DIAGY,0 ;1 => servo in diagnostic mode, saves jnt vars in DBUF
STSW NEWKER,1 ;1 => use the new version of the kernel
.IFNZ NEWKER
.INSRT K1DEF.PAL[11,SYS]
.IFF
.INSRT KDEF.PAL[11,SYS]
UGRSAV == UGPSAV ;Has a new meaning in K1.
.ENDC
.INSRT HALIO.PAL[HAL,HE]
.INSRT LARGEB.PAL[HAL,HE]
.IFNZ SMALLB
.INSRT SMALLB.PAL[HAL,HE]
.ENDC
.IFNZ INTLOAD
.INSRT INTERP.PAL[HAL,HE]
.INSRT ARITH.PAL[HAL,HE]
.ENDC
.IFNZ GRAPHS
.INSRT GRAPHS.PAL[HAL,HE]
.ENDC
.IFNZ MOVING
.INSRT ARM.PAL[11,BES]
.INSRT ARMSOL.PAL[11,BES]
.ENDC
;Data areas
.IFZ NEWKER
.BLKW 100 ;Stack
STACK: .BLKW 1 ;
.ENDC
ISTBLK: .BLKW ISBS ;Dummy interpreter status block (used in linking only)
ENVIRO: .BLKW 100 ;Environment
.IFNZ NEWKER
MAINBL: PDBLK 100,S ;Makes a process descriptor for main process
.IFF
PDBLK MAINBL,100,S ;Makes a process descriptor for main process
.ENDC
PUTLOC JOBDAT, MAINBL
PUTLOC JOBSA, START
.IFZ NEWKER
PUTLOC JOBPDL, STACK
.ENDC
; program initialization
START:
JSR PC,FRINIT ;Initialize free storage
.IFNZ SMALLB
CALL SBINIT ;Initialize small block space
.ENDC
.IFNZ GRAPHS
JSR PC,GSINIT ;Initialize graph structure
.ENDC
.IFNZ INTLOAD ;Initialize the interpreter
EVMAK ;Initialize the INTEVT for interlocking said list.
MOV (SP)+,INTEVT;
EVSIG INTEVT ;
MOV #ISBS,R0 ;R0 ← Size (in words) of an interpreter status block
JSR PC,GTFREE ;R0 ← LOC[new interpreter status block]
CLR LEV(R0) ;new LEV ← 0
MOV R0,NXTINT+ISTBLK ;Prime the interpreter list.
CLR NXTINT(R0) ;
MOV #INSTRT,IPC(R0) ;new IPC ← interpreter start address
MOV #ENVIRO,ENV(R0) ;new ENV ← ENVIRO
EVMAK ;-(SP) ← event for EVT in this interpreter
MOV (SP),EVT(R0);new EVT ← event just created.
MOV R0,-(SP) ;Save LOC[new interpreter status block]
MOV #INSTSZ,R0 ;R0 ← Size needed for an interpreter stack
JSR PC,GTFREE ;R0 ← LOC[new interpreter stack]
MOV (SP)+,R1 ;R1 ← LOC[new interpreter status block]
MOV R0,STKBAS(R1) ;Store away new stack base
ADD #2*INSTSZ,R0 ;R0 ← LOC[top of new stack] (INSTSZ is in bytes)
MOV R1,-(SP) ;Save R1
MOV R0,-(SP) ;Save R0
MOV #210,R0 ;Room for process descriptor
JSR PC,GTFREE ;R0 ← LOC[new process descriptor]
MOV #UFPUSE+UGRSAV,PDBSTA(R0);Use floating point, use saved registers.
.IFNZ NEWKER
MOV #420,UPDLEN(R0) ;Length of PCB
.IFF
MOV #100,PDBSSV(R0) ;Length of stack to be saved.
.ENDC
MOV (SP)+,R1 ;R1 ← LOC[new interpreter stack top]
MOV R1,PDBR3(R0) ;Store away new interp stack pointer (reg 3)
MOV (SP)+,R1 ;R1 ← LOC[new ISB]
MOV R0,PCB(R1) ;Store away LOC[PCB] in new ISB
MOV R1,PDBR4(R0) ;Store away LOC[ISB] in reg 4 of PCB
MOV SP,R1 ;
TST (R1)+ ;
MOV R1,PDBSP(R0) ;Store away the new stack pointer (reg 6)
MOV #INTERP,PDBPC(R0);Store away the new PC
ADD #PDBSTA,R0 ;Move R0 to the middle of the process descriptor
SCHEDU R0,#INTERP,#0,#2;Cause the new process to be started, suspended
EVWAIT (SP) ;Wait for the return signal
BCC TST1 ;All well?
HALERR TSTMES ;No
TST1: MOV #TSTME1,R0 ;
JSR PC,TYPSTR ;Say farewell
DISMIS ;Go away
TSTMES: ASCIE </BAD RETURN FROM MAIN INTERPRETER/>
TSTME1: ASCIE </
ALL DONE NOW. SEE YOU AROUND!
/>
;End of the interpreter calling sequence
.IFF ;do some test without the iterpreter
.PRINT /Not loading the interpreter
/
JMP FSTEST ;Try out the test routine for small blocks.
.ENDC
PATCH: .BLKW 100
.IF2
FOO==.
.INFO <First location after interpreter = >,\FOO
.IFL 44000-FOO
.ERR Interpreter too long
.ENDC
.ENDC
.END